const { defineConfig } = require("@vue/cli-service");
const path = require("path");
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    host: "localhost",
    port: 3000,
    open: true,
    proxy: {
      // 配置反向代理
      "/api": {
        target: "http://syt.atguigu.cn",
        changeOrigin: true,
        // 路径重写
        pathRewrite: {
          "^/api": "/api",
        },
      },
    },
  },
  //自定义路径别名
  chainWebpack: (config) => {
    // 给路径起别名
    config.resolve.alias
      .set("@", path.join(__dirname, "src"))
      .set("@c", path.join(__dirname, "src/components"))
      .set("@v", path.join(__dirname, "src/views"))
      .set("@s", path.join(__dirname, "src/store"))
      .set("@r", path.join(__dirname, "src/router"));
  },
});
